package cn.wolfcode.p2p.base.domain;

import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Getter@Setter
public class IpLog extends BaseDomain{
        public static final int STATE_SUCCESS=0;
        public static final int STATE_FAIL=1;
        private String ip;
        private Integer state=STATE_SUCCESS;//登录成功和失败
        private String username;
        @DateTimeFormat(pattern = "yyyy-MM-dd")
        private Date loginTime; // 最后登录事件
        private Integer userType=LoginInfo.TYPE_WEBSITE;//根据用户类型来查登录记录

        public String getStateName(){
                return state==STATE_SUCCESS?"登录成功":"登录失败";
        }
        public String getUserTypeNa(){
                return userType==LoginInfo.TYPE_WEBSITE?"前台用户":"后台用户";
        }

}
